/**
 * Copyright (c) 2014-2015, Suredy technology Co., Ltd. All rights reserved.
 * @author ZhangMaoren 
 * @since 2015年4月27日
 * @version 0.1
 */
package com.suredy.base.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.suredy.core.model.BaseModel;


/**
 * @author ZhangMaoren
 *
 */
@Entity
@Table(name = "T_SECURITY_USER2ROLE")
public class User2Role extends BaseModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1353714858463404223L;

	
	@Column(name = "USERID", length = 32)
	private String userId;
	
	@Column(name = "ROLEID", length = 32)
	private String roleId;
	
	
	/**
	 * @return the userId
	 */
	public String getUserId() {
		return userId;
	}

	
	/**
	 * @param userId the userId to set
	 */
	public void setUserId(String userId) {
		this.userId = userId;
	}

	
	/**
	 * @return the roleId
	 */
	public String getRoleId() {
		return roleId;
	}

	
	/**
	 * @param roleId the roleId to set
	 */
	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		User2Role user2Role = (User2Role) o;

		if (id != null ? !id.equals(user2Role.id) : user2Role.id != null) {
			return false;
		}
		if (roleId != null ? !roleId.equals(user2Role.roleId)
				: user2Role.roleId != null) {
			return false;
		}
		if (userId != null ? !userId.equals(user2Role.userId)
				: user2Role.userId != null) {
			return false;
		}

		return true;
	}

	@Override
	public int hashCode() {
		int result = id != null ? id.hashCode() : 0;
		result += (userId != null ? userId.hashCode() : 0);
		result += (roleId != null ? roleId.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "User2Role[id=" + id + ", userId=" + userId + ", roleId="
				+ roleId + "]";
	}
}
